/**
 * Abstract cookie away
 **/
var cookie = (function() {
	var cookie = new Mojo.Model.Cookie('cookie');
	if (!cookie.get()) {
		say('initializing empty cookie');
		cookie.put({});
	}
	return {
		get: function(key) {
			if (key) {
				return typeof cookie.get(key) === 'string' ? cookie.get(key) : undefined;
			} else {
				return cookie.get();
			}
		},
		set: function(k,v) {
			say(k + " => " + v);
			var obj = cookie.get();
			obj[k] = v;
			cookie.put(obj);
		},
		destroy: function() {
			cookie.put({});
		}
	};
})();
